home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Program Name: Stiletto */
- /* */
- /* File Name: Init.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-06-30 Chris Halim Original version */
- /* 1995-06-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "Fonts.h"
- #include "Resources.h"
-
- //#include "ISDNToolIntf.h"
- #include "Telephones.h"
-
- #include "About.h"
- #include "CAHandlers.h"
- #include "CallBackRoutines.h"
- #include "Constants.h"
- #include "DNHandlers.h"
- #include "Init.h"
- #include "LogWindow.h"
- #include "ModuleWindow.h"
- //#include "RPWindow.h"
- #include "Stiletto.h"
- #include "TermWindow.h"
- #include "TestModule.h"
- #include "Utilities.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- /****************************************** PROTOTYPES ******************************************/
-
- OSErr SetUpUPPs (void);
- OSErr SetupMenuBar (void);
-
- /******************************************** GLOBALS *******************************************/
-
- ModalFilterUPP gAboutFilterUPP;
- UserItemUPP gDrawAboutPictUPP;
- UserItemUPP gDrawVersUPP;
- ModalFilterUPP gStandardFilterUPP;
- UserItemUPP gDrawBoxUPP;
- UserItemUPP gDrawDefaultUPP;
- TelephoneCAMsgUPP gCAMsgHandlerUPP;
- TelephoneCAMsgUPP gCAConfMsgHandlerUPP;
- TelephoneDNMsgUPP gDNMsgHandlerUPP;
- TelephoneCAMsgUPP gCAActiveMsgHandlerUPP;
- ControlActionUPP gVActionProcUPP;
- DlgHookYDUPP gGetDirDialogHookUPP;
- ModalFilterYDUPP gGetDirModalFilterUPP;
- //RPCompletionUPP gRPCompletionRoutineUPP;
- TelephoneCAMsgUPP gAllCAMsgsHandlerUPP;
- TelephoneDNMsgUPP gAllDNMsgsHandlerUPP;
- TelephoneTermMsgUPP gAllTermMsgsHandlerUPP;
- TelephoneTermMsgUPP gTermMsgHandlerUPP;
- ModalFilterUPP gAlertUserFilterUPP;
- //PutLineUPP gPutLineUPP;
- EntryPointUPP gEntryPointUPP;
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- #pragma segment Initialize
- OSErr SetUpUPPs (void)
- {
- gAboutFilterUPP = NewModalFilterProc (AboutFilterProc);
- if (gAboutFilterUPP != NULL) {
- gDrawAboutPictUPP = NewUserItemProc (DrawAboutPict);
- if (gDrawAboutPictUPP != NULL) {
- gDrawVersUPP = NewUserItemProc (DrawVers);
- if (gDrawVersUPP != NULL) {
- gStandardFilterUPP = NewModalFilterProc (StandardFilterProc);
- if (gStandardFilterUPP != NULL) {
- gDrawBoxUPP = NewUserItemProc (DrawBox);
- if (gDrawBoxUPP != NULL) {
- gDrawDefaultUPP = NewUserItemProc (DrawDefault);
- if (gDrawDefaultUPP != NULL) {
- gCAMsgHandlerUPP = NewTelephoneCAMsgProc (CAMsgHandler);
- if (gCAMsgHandlerUPP != NULL) {
- gCAConfMsgHandlerUPP = NewTelephoneCAMsgProc (CAConfMsgHandler);
- if (gCAConfMsgHandlerUPP != NULL) {
- gDNMsgHandlerUPP = NewTelephoneDNMsgProc (DNMsgHandler);
- if (gDNMsgHandlerUPP != NULL) {
- gCAActiveMsgHandlerUPP = NewTelephoneCAMsgProc (CAActiveMsgHandler);
- if (gCAActiveMsgHandlerUPP != NULL) {
- gVActionProcUPP = NewControlActionProc (VActionProc);
- if (gVActionProcUPP != NULL) {
- gGetDirDialogHookUPP = NewDlgHookYDProc (GetDirDialogHook);
- if (gGetDirDialogHookUPP != NULL) {
- gGetDirModalFilterUPP = NewModalFilterYDProc (GetDirModalFilter);
- if (gGetDirModalFilterUPP != NULL) {
- // gRPCompletionRoutineUPP = NewRPCompletionProc (RPCompletionRoutine);
- // if (gRPCompletionRoutineUPP != NULL) {
- gAllCAMsgsHandlerUPP = NewTelephoneCAMsgProc (AllCAMsgsHandler);
- if (gAllCAMsgsHandlerUPP != NULL) {
- gAllDNMsgsHandlerUPP = NewTelephoneDNMsgProc (AllDNMsgsHandler);
- if (gAllDNMsgsHandlerUPP != NULL) {
- gAllTermMsgsHandlerUPP = NewTelephoneTermMsgProc (AllTermMsgsHandler);
- if (gAllTermMsgsHandlerUPP != NULL) {
- gTermMsgHandlerUPP = NewTelephoneTermMsgProc (TermMsgHandler);
- if (gTermMsgHandlerUPP != NULL) {
- gAlertUserFilterUPP = NewModalFilterProc (AlertUserFilterProc);
- if (gAlertUserFilterUPP != NULL) {
- // gPutLineUPP = NewPutLineProc (PutLine);
- // if (gPutLineUPP != NULL) {
- gEntryPointUPP = NewEntryPointProc (EntryPoint);
- if (gEntryPointUPP != NULL) {
- return (noErr);
- }
- // }
- }
- }
- }
- }
- }
- // }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return (mmInternalError);
- }
-
-
- #pragma segment Initialize
- OSErr SetupMenuBar (void)
- {
- Handle aHandle;
-
- aHandle = GetNewMBar (rMenuBar); // Get MBAR resource.
- if (aHandle == nil) {
- AlertUser ("\pUnable to get an MBAR resource !", ResError ());
- return (ResError ());
- }
- else {
- SetMenuBar (aHandle); // And set it as the default menu bar.
- DisposHandle (aHandle); // Mac creates its own copy !!
-
- AddResMenu (GetMHandle (rAppleMenu), 'DRVR'); // Append all Apple Menu Items into menu.
-
- AdjustMenus (); // Adjust hiliting of menu items.
- DrawMenuBar ();
-
- return (noErr);
- }
- }
-
-
- #pragma segment Initialize
- OSErr Initialize (void)
- {
- OSErr errCode;
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( nil );
-
- if ((errCode = SetUpUPPs()) == noErr) {
- if ((errCode = SetupMenuBar ()) == noErr) // Put the default menu bar on the screen.
- InitCursor();
-
- InitializedAppleEvents ();
- }
-
- return (errCode);
- }
-
-
-